package org.hikari.qqbot.xiuxian.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hikari.qqbot.client.message.Message;
import org.hikari.qqbot.xiuxian.service.ITaskService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * created at 2024-12-09 21:46:08
 *
 * @author yinchao
 * @version 1.0
 **/
@Slf4j
@RequiredArgsConstructor
@RestController
public class LLOneBotCallbackController {

    private final ITaskService taskService;

    @RequestMapping("/callback")
    public Object messageCallback(@RequestBody Message request) {
        log.debug("[callback - {}] 发送者: {} 消息: {}", request.getSelf_id(), request.getUser_id(), request.getRaw_message());
        taskService.processMessage(request);
        return "success";
    }

}
